package view.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.Gallery;

public class SlowFlingGallery extends Gallery {

	public SlowFlingGallery(Context context) {
		super(context);
	}

	public SlowFlingGallery(Context context, AttributeSet attrs) {
		super(context, attrs);
	}

	public SlowFlingGallery(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
	}

	@Override
	public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
			float velocityY) {
		
		//limit the max speed in either direction
        if (velocityX > 1000.0f)
        {
            velocityX = 1000.0f;
        }
        else if(velocityX < 1000.0f)
        {
            velocityX = -1000.0f;
        }
		
		return super.onFling(e1, e2, velocityX, velocityY);
	}
	
	

}
